import React from 'react';
import {List} from 'react-virtualized';

// 长列表渲染的数组
const list = [
  'Brian Vaughn',
  // And so on...
//   快速生成100条数据
  ...new Array(100).keys()
];

 

class ReactList extends React.Component {
    rowRenderer=({
        key, 
        index, 
        isScrolling, 
        isVisible, 
        style,
      })=> {
        return (
          <div key={key} style={style}>
            {list[index]}
          </div>
        );
      }
    rowHeight=({index})=>{
        return 40*index
    }
    render() { 
        return (
            <List
            //这样可以获取屏幕宽度的100%
    width={window.screen.width}
     //这样可以获取屏幕高度的100%
    height={window.screen.height}
    rowCount={list.length}
    rowHeight={this.rowHeight}
    rowRenderer={this.rowRenderer}
  />
        );
    }
}
 
export default ReactList;